package factory;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

import org.springframework.stereotype.Component;




public class ManagerFactory {
	
	private static EntityManager entityManager;
	
	
	public static EntityManager getInstance(String name){
		if(entityManager==null){
			EntityManagerFactory fatory = Persistence.createEntityManagerFactory(name);
			entityManager = fatory.createEntityManager();
		}
		return entityManager;
		
	}
	
}
